<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:f="http://kadm.org.ua/XMLSchema/Forum"
    xmlns="http://www.w3.org/1999/xhtml"
    xml:lang="ru">

    <xsl:output
        method="html"
        encoding="UTF-8"
        media-type="text/html"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
        doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
        indent="yes"
        />

    <xsl:strip-space elements="*"/>

    <xsl:template match="*">
        <xsl:element name="{name()}">
             <xsl:apply-templates select="@*" />
             <xsl:apply-templates />
        </xsl:element>
    </xsl:template>

    <xsl:template match="text() | comment() | @*">
        <xsl:copy/>
    </xsl:template>

    <xsl:template match="f:entry">
        <html>
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                <title><xsl:value-of select="@name" /></title>
                <link type="text/css" rel="stylesheet" href="forum.css" />
            </head>
            <body>
                <xsl:apply-templates />
            </body>
        </html>
    </xsl:template>

    <xsl:template match="f:post">
        <div class="post" id="post-{@id}">
        <div class="tl"><div class="tr"><div class="bl"><div class="br">
            <h3>№<xsl:value-of select="@id" />&#160;<span class="author"><xsl:value-of select="@author" /></span></h3>
            <xsl:apply-templates />
        </div></div></div></div>
        </div>
    </xsl:template>

    <xsl:template match="f:blockquote">
        <blockquote class="first-child">
        <div class="tl"><div class="tr"><div class="bl"><div class="br">
            <xsl:if test="not(@not-show-author)">
                <xsl:variable name="ref-id" select="@cite" />
                <strong class="author"><xsl:value-of select="/f:entry/f:post[@id = $ref-id]/@author" />:</strong>
            </xsl:if>
            <xsl:apply-templates />
        </div></div></div></div>
        </blockquote>
    </xsl:template>

    <xsl:template match="f:author">
        <strong class="author"><xsl:apply-templates /></strong>
    </xsl:template>

</xsl:stylesheet>
